#include "udp_server.hpp"
#include "Dicitonary.hpp"

#include <memory>
int main(int argc, char* argv[])
{
    // std::string t;
    // Dictionary::Getinstace()->Debug();
    // while(true)
    // {
    //     std::cin >> t;
    //     std::cout << "查询: " << t << " ";
    //     std::cout << " 结果为: " << Dictionary::Getinstace()->Translate(t) << std::endl;
    // }
    if (argc != 2)
    {
        std::cout << "Please use for ./server_udp + port!!" << std::endl;
        Die(USE_ERROR);
    }
    auto dict = Dictionary::Getinstace();
    std::shared_ptr<Udp_server> server = std::make_shared<Udp_server>(
        [&dict](std::string&word){ return dict->Translate(word);
    });

    server->Init();
    server->Start();
    return 0;
}